<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#myCanvas{
	background-color:#CCC;
	border:solid thin  #666;
}
</style>
</head>

<body>
<canvas id="myCanvas" width="640" height="480"></canvas>
</body>
</html>

<script language="javascript">
	window.onload = function()
	{	
		var screenWidth = 640;
		var screenHeight = 480;		
		var canvas = document.getElementById("myCanvas");
		var context = canvas.getContext("2d");	
		var m = {}

		
		function tbox (){
			this.x = null;
			this.y = null;
			this.d = function(context, aa)
			{
				context.fillText( this.x + "-" + this.y, 100, aa );
			}
		}
		
		for ( var i = 0; i < 10; i++)
		{
			m[i] = new tbox();
			m[i].x = i;
			m[i].y = i * 10;
		}
		
		

		setInterval(mainLoop, 10);
		
		
		function mainLoop()
		{	
			// Clear Screen			
			context.clearRect(0, 0, screenWidth, screenHeight);									

			context.fillText( "Example: HTML5 Test Boxes", 20 , 20 );			
						
			for ( var i = 0; i < 10; i++)
			{
				context.beginPath();
				m[i].d(context, 20 * i);
				context.closePath();
				context.stroke();
				
			}			
			
		}						
		
		
	}
	
	
</script>
